package me.jiatao.wan.data.mapper

import me.jiatao.wan.data.database.entity.ArticleEntity
import me.jiatao.wan.data.database.entity.ArticleType
import me.jiatao.wan.data.network.pojo.ArticlePojo
import me.jiatao.wan.model.ArticleModel

/**
 * @Author: taojia
 * @CreateDate: 2021/8/27 5:38 下午
 * @Version: 1.0
 * @Description:
 */

object ArticleMapper {
    fun articlePojo2Model(input: ArticlePojo): ArticleModel = ArticleModel(
        id = input.id,
        author = input.author,
        niceDate = input.niceDate,
        title = input.title,
        envelopePic = input.envelopePic,
        isTop = input.isTop,
        superChapterName = input.superChapterName,
        chapterName = input.chapterName,
        isCollect = input.collect,
        link = input.link
    )


    fun articlePojo2Entity(input: ArticlePojo, articleType: ArticleType): ArticleEntity =
        ArticleEntity(
            articleId = input.id,
            author = input.author,
            niceDate = input.niceDate,
            title = input.title,
            envelopePic = input.envelopePic,
            isTop = input.isTop,
            superChapterName = input.superChapterName,
            chapterName = input.chapterName,
            isCollect = input.collect,
            link = input.link,
            articleType = articleType
        )

    fun articleEntity2Model(input: ArticleEntity): ArticleModel = ArticleModel(
        id = input.articleId,
        author = input.author,
        niceDate = input.niceDate,
        title = input.title,
        envelopePic = input.envelopePic,
        isTop = input.isTop,
        superChapterName = input.superChapterName,
        chapterName = input.chapterName,
        isCollect = input.isCollect,
        link = input.link
    )
}